﻿using Sustainalytics.Accounts.BusinessLogic;
using Sustainalytics.Common.Hosting;
using Sustainalytics.Utils.Serilog;
using Sustainalytics.WebApiHosting;


namespace Sustainalytics.Accounts.Service.Infrastructure
{
    class AccountsServiceApplication: ServiceApplication
    {
        public AccountsServiceApplication() : base()
        {

        }

        public AccountsServiceApplication(IBasicLogger logger) : base(logger)
        {

        }
        protected override void AddStartupServices()
        {
            RegisterService(new WebApiServiceDefinition<Startup>(HostConfig.GetHostUrl(), "accountsService"));
        }

       protected override bool HandleStartException(System.Exception e)
        {
            CommonEventSerilog.Log.ApplicationStartError(e);
            return false;
        }

        protected override bool HandleStopException(System.Exception e)
        {
            CommonEventSerilog.Log.ApplicationStopError(e);
            return false;
        }

        protected override void OnUnhandledDomainException(System.Exception e)
        {
            CommonEventSerilog.Log.OnUnhandledDomainException(e);
        }

    }
}
